<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

  
    <div class="form-group">
        <label for="c-property_number" class="control-label col-xs-12 col-sm-2">{:__('Property_number')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_number" data-rule="required" class="form-control" name="row[property_number]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_large_category" class="control-label col-xs-12 col-sm-2">{:__('Property_large_category')}:</label>
        <div class="col-xs-12 col-sm-8"> 
            <select  id="c-property_large_category" data-rule="required" class="form-control selectpicker" name="row[property_large_category]">
                <option value="" >请选择所属大类</option>
                {foreach name="property_large_category" item="vo"}
                    <option value="{$key}" >{$vo}</option>
                {/foreach}
            </select> 
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_small_category" class="control-label col-xs-12 col-sm-2">{:__('Property_small_category')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select  id="c-property_small_category" data-rule="required" class="form-control" name="row[property_small_category]"> 
            </select>  
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_name" class="control-label col-xs-12 col-sm-2">{:__('Property_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_name" data-rule="required" class="form-control" name="row[property_name]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_sku" class="control-label col-xs-12 col-sm-2">{:__('Property_sku')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_sku" data-rule="required" class="form-control" name="row[property_sku]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_buy_time" class="control-label col-xs-12 col-sm-2">{:__('Property_buy_time')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_buy_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[property_buy_time]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_status" class="control-label col-xs-12 col-sm-2">{:__('Property_status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="propertyStatusList" item="vo"}
            <label for="row[property_status]-{$key}"><input id="row[property_status]-{$key}" name="row[property_status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label for="c-property_warehouse" class="control-label col-xs-12 col-sm-2">{:__('Property_warehouse')}:</label>
        <div class="col-xs-12 col-sm-8">

  <select  id="c-property_warehouse" data-rule="required" class="form-control selectpicker" name="row[property_warehouse]">
                {foreach name="warehouse" item="vo"}
                    <option value="{$key}" >{$vo}</option>
                {/foreach}
            </select>

 

        </div>
    </div>

    <div class="form-group">
        <label for="c-property_due_date" class="control-label col-xs-12 col-sm-2">{:__('Property_due_date')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_due_date" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[property_due_date]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>

    <div class="form-group">
        <label for="c-property_account" class="control-label col-xs-12 col-sm-2">{:__('Property_account')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_account" class="form-control" step="0.01" name="row[property_account]" type="number">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_depreciation" class="control-label col-xs-12 col-sm-2">{:__('Property_depreciation')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_depreciation" class="form-control" name="row[property_depreciation]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-property_residual_value" class="control-label col-xs-12 col-sm-2">{:__('Property_residual_value')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-property_residual_value" class="form-control" name="row[property_residual_value]" type="text">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script src="__CDN__/style/js/jquery-1.11.3.js"></script>
<script type="text/javascript">
$(function() {
        $("#c-property_large_category").change(function() {
            var option = '';
            var data = {}; 
            data['parent_code'] = $('#c-property_large_category').find('option:selected').val();
            $.ajax({
                url:"{:url('property/getDictionary')}",
                data:data,
                type:'POST',
                dataType:'json',
                beforeSend:function(result){
                     layer.load(1, {shade: [0.5,'#000'] });
                },
                success:function(result){ 
                    layer.closeAll();  
                    for (var i=0;i<result.length;i++){  
                      option += "<option value='"+result[i]['code']+"'  >"+result[i]['name']+"</option>"; 
                    }  
                    console.log(option);
                    $('#c-property_small_category').html(option);    
                }
            });
        });
    });
</script>